﻿#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include "imageitem.h"
#include "QtRowTableModel.h"

class ImageItem;
class MergeDialog;

namespace Ui {
class MainWidget;
}

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MainWidget(QWidget *parent = 0);
    ~MainWidget();

    QImage MergeImageV(QList<QImage> images,int leftMargin,int rightMargin,int topMargin,int bottomMargin,int space);

    ImageItemPtr getCurrentImg() const;
    void setCurrentImg(const ImageItemPtr &currentImg);

    QImage ps(QImage img,int ld, int dbd,int bhd);

protected:
    QList<QImage> getImages();

private slots:
    void on_pbOpen_clicked();

    void on_pbUp_clicked();

    void on_pbDown_clicked();

    void on_pbPreview_clicked();

    void on_pb_delete_clicked();

    void on_pb_clear_pressed();

    void on_slider_ld_valueChanged(int value);

    void on_silider_dbd_valueChanged(int value);

    void on_slider_bhd_valueChanged(int value);

private:
    Ui::MainWidget *ui;

    QtRowTableModel<ImageItem> *mModel = nullptr;

    MergeDialog *mPreview = nullptr;

    ImageItemPtr m_currentImg;
};

#endif // MAINWIDGET_H
